package com.tmt.im.manager.mapstruct;

import com.tmt.data.jpa.service.beans.UserInfoVo;
import com.tmt.im.common.pojo.IMUserPoJo;
import com.tmt.im.jpa.entity.IMUser;
import com.tmt.im.manager.controller.vo.UserInfoVoEx;
import com.tmt.im.manager.controller.vo.UserInfoVoEx1;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/7/15 16:09
 * @Version 1.0
 **/
@Component
@Mapper(componentModel = "spring")
public interface IMUserMapStruct {

    UserInfoVo toUserInfoVo(IMUser user);

    @Mappings({
            @Mapping(target = "verified", expression = "java(org.springframework.util.StringUtils.hasText(user.getCertNo()))"),
            @Mapping(target = "enableNewMsgNotify", source = "user.setting.enableNewMsgNotify"),
            @Mapping(target = "enableSoundHint",  source = "user.setting.enableSoundHint"),
            @Mapping(target = "enableShockHint",  source = "user.setting.enableShockHint")
    })
    UserInfoVoEx toUserInfoVoEx(IMUser user);

    List<UserInfoVoEx> toUserInfoVoExs(List<IMUser> users);

    UserInfoVoEx1 toUserInfoVoEx1(IMUserPoJo userPoJo);

    List<UserInfoVoEx1> toUserInfoVoExs1(List<IMUserPoJo> userPoJos);

    IMUserPoJo toIMUserPoJo(IMUser user);

}
